#ifndef _SITE_H_
#define _SITE_H_

#include "processor.h"
#include "link.h"
#include "storage.h"
#include "filechecker.h"

class Site {
	private:
		const char *domain;
		Processor **processors;
		Storage *storage;
		Link *link;
		int numberOfProcessors;
		bool processorAvailableInformation;
		bool networkAvailableInformation;		
	public:
		/*Instantiate a site that contains 1 storage and a intra-site link. After, processors must be added*/
		Site(const char *domain,  long double link_bw);
		/*Instantiate a site that contains 1 storage and a trace-based intra-site link. After, processors must be added*/
		Site(const char *domain, const char *link_bw, long double link_bw_offset, const char *bw_error, const char *link_bw_forecast=NULL);
		~Site();
		/*Gets the site domain*/
		const char *getDomain();		
		/*Add a trace-based processor*/
		void addProcessor(long double relSpeed, const char *cpu_avail_trace, long double cpu_offset, const char *cpu_avail_error, const char *cpu_avail_forecast=NULL);
		/*Add a fixed-value processor*/
		void addProcessor( long double relSpeed, long double fixed_cpu);		
		/*Get a processor by index*/
		Processor *getProcessorByIndex(int index);
		/*Get a processor by Name*/
		Processor *getProcessorByName(const char *name);
		/*Get the number of Processors*/
		int getNumberOfProcessors();
		/*Get the link of this site*/
		Link *getLink();
		/*Get the storage*/
		Storage *getStorage();
		/*Verify if the site containa a given data*/
		bool hasData(DataElement *data);
		/*Verify if all processors of this site are busy*/
		bool allProcessorsAreBusy();
		/*Get the current number of tasks allocated to this site*/
		int getNumberOfAllocatedTasks();
		
		/*Set the Site to Available or Unavailable information*/
		void setProcessorInformationAvailable();
		void setProcessorInformationNotAvailable();		
		void setNetworkInformationAvailable();
		void setNetworkInformationNotAvailable();		
		void setAllInformationAvailable();
		void setAllInformationNotAvailable();		
		
		/*Returns site status regarding with available infomration*/
		bool hasAllAvailableInformation();
		bool hasProcessorAvailableInformation();
		bool hasNetworkAvailableInformation();				

};

#endif //_SITE_H_
